#include <iostream>
#include "Accpetor.h"
#include "TcpConnection.h"

using std::cout;
using std::endl;

void test()
{
    Accpetor acceptor("127.0.0.1", 8888);
    acceptor.ready();

    TcpConnection tcp(acceptor.accept());
    tcp.toString();
    cout << "has connected." << endl;
    while(1)
    {
        cout << ">>recv from client :" << tcp.receive() << endl;
        tcp.send("i have received.\n");
    }
}

int main(int argc,char *argv[])
{
    test();
    return 0;
}


